package com.sunny.wordstudy.lib;

import android.media.AudioManager;
import android.media.MediaPlayer;
import com.sunny.wordstudy.StudyView;
import com.sunny.wordstudy.ah;
import java.io.File;
import java.io.PrintStream;

public class Study
{
  private static Study a;
  private StudyView b;
  private MediaPlayer c = null;
  private int d = 9;
  private int e = 9;
  private AudioManager f = null;
  private ah g = null;

  static
  {
    Study localStudy = new Study();
    a = localStudy;
    localStudy.doInit();
  }

  public static Study a()
  {
    return a;
  }

  public native void BeginSession(int paramInt);

  public void CancelWait(int paramInt)
  {
    this.b.f();
  }

  public void CheckRegInfo(int paramInt)
  {
    this.b.d(paramInt);
  }

  public native boolean DealKeyPress(int paramInt);

  public boolean DoInputWord(String paramString1, String paramString2)
  {
    return this.b.a(paramString1);
  }

  public native void EndSession();

  public void FinishStudy()
  {
    this.b.finish();
  }

  public void PlaySound()
  {
    this.g.b();
  }

  public void ReformShowDataInfo()
  {
    if (this.b == null)
      return;
    this.b.e();
  }

  public native void SecondStep(int paramInt, String paramString);

  public int ShowChooseResult(int paramInt)
  {
    return this.b.b(paramInt);
  }

  public int ShowConfirm(int paramInt)
  {
    return this.b.c(paramInt);
  }

  public int ShowInputResult(int paramInt)
  {
    return this.b.a(paramInt);
  }

  public int ShowWait(int paramInt)
  {
    return this.b.e(paramInt);
  }

  public void StopSound()
  {
    try
    {
      this.c.reset();
      return;
    }
    catch (Exception localException)
    {
      System.err.print("Stop Sound Err: " + localException.getMessage());
    }
  }

  public native void WordKnow(boolean paramBoolean);

  public final void a(int paramInt, boolean paramBoolean)
  {
    this.d = paramInt;
    if (this.d > 10)
      this.d = 10;
    if (this.d < 0)
      this.d = 0;
    if (paramBoolean);
    try
    {
      int i = this.f.getStreamMaxVolume(3);
      this.e = this.f.getStreamVolume(3);
      this.f.setStreamVolume(3, i * this.d / 10, 1);
      return;
    }
    catch (Exception localException)
    {
      String str = localException.getMessage();
      System.err.print("Set Play Sound Volume Err: " + str);
    }
  }

  public final void a(StudyView paramStudyView)
  {
    this.b = paramStudyView;
  }

  public final void a(ah paramah)
  {
    this.g = paramah;
    if (this.c == null)
      this.c = new MediaPlayer();
    if (this.f != null)
      return;
    this.f = paramah.a();
  }

  public final int b()
  {
    return this.d;
  }

  public final void c()
  {
    if (!(Stat.isLoadedVoice()))
      this.g.c();
    while (true)
    {
      return;
      File localFile1 = new File("/sdcard/wordstudy/");
      if (!(localFile1.exists()))
        localFile1.mkdirs();
      String str1 = "word.wav";
      if (Stat.isMp3Voice())
        str1 = "word.mp3";
      File localFile2 = new File("/sdcard/wordstudy/" + str1);
      if ((localFile2.exists()) && (localFile2.length() > 512L) && (!(this.c.isPlaying())))
        try
        {
          this.c.reset();
          this.c.setAudioStreamType(3);
          int i = this.f.getStreamMaxVolume(3);
          this.e = this.f.getStreamVolume(3);
          this.f.setStreamVolume(3, i * this.d / 10, 0);
          this.c.setDataSource("/sdcard/wordstudy/" + str1);
          this.c.prepare();
          this.c.start();
          this.c.setOnCompletionListener(new a(this));
        }
        catch (Exception localException)
        {
          String str2 = localException.getMessage();
          System.err.print("Play Sound Err: " + str2);
        }
      this.g.c();
    }
  }

  public native void doInit();

  public native int getRecallStudy();

  public native int getWordStatus();

  public native boolean isShowAns();

  public native boolean isShowRel();

  public native boolean isShowSample();

  public native boolean isShowStatus();

  public native void setAutoSound(int paramInt);

  public native void setRecallStudy(int paramInt);
}

/* Location:           E:\Desktop\Android\wordstd\classes_dex2jar.jar
 * Qualified Name:     com.sunny.wordstudy.lib.Study
 * JD-Core Version:    0.5.3
 */